//
//  IndexVC.m
//  SYPerfectDemo
//
//  Created by Lssyyy on 2018/4/26.
//  Copyright © 2018年 Lssyyy. All rights reserved.
//

#import "IndexVC.h"
#import "DES3Util.h"
#import "CryptosUtility.h"
#import "NSString+NSData.h"
#import "UIView+Alert.h"
#import "Person.h"
#import "RYIMTestVC.h"
#import "JMVersionUpdateView.h"
#import "JMMemberCardAddFormVC.h"
#import "VasSonicVC.h"
#import "JMWKWebView.h"
#import "JMBCouponManagerVC.h"
#define DES_SIGN_KEY @"deskeyzfs2017"
#define MD5KEY @"md5keyzfs2017"

@interface IndexVC ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
@property (nonatomic,copy) id unKnow;
@property (nonatomic,strong) NSMutableArray *array;

@end
const NSString*associatedKey=@"associate_nsarray_with_nsstring_key";//设置key
@implementation IndexVC{
    UILabel *_label[2];
    NSString *_age;
}
@synthesize name = _myName;
- (void)loadView{
    [super loadView];
    NSLog(@"---%s",__FUNCTION__);
}
- (void)viewDidLoad {
    [super viewDidLoad];
     NSLog(@"---%s",__FUNCTION__);
    self.array = [NSMutableArray arrayWithObjects:@"1",@"2", nil];
    
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    NSLog(@"---%s",__FUNCTION__);
}
- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
     NSLog(@"---%s",__FUNCTION__);
}
//fenzhiNet添加一行
- (void)addUI{
    self.view.backgroundColor = kWhiteColor;
    NSLog(@"本地分支测试");
    NSLog(@"分支并入主分支");
}
- (void)aaaa{
    NSLog(@"我开发了许多功能在这里123456123456");
}
- (void)bbbb{
    NSLog(@"这是我在分支开发的功能");
}
- (void)cccc{
    NSLog(@"这是我在分支合并后开发的功能");
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
//    RYIMTestVC *vc = [RYIMTestVC new];
//    [self.navigationController pushViewController:vc animated:YES];
    //   App Key: uwd1c0sxup2v1
//    App Secret :urHkMV3NU8kGo3
    
    Person *pp = [Person shareInstance];
//    Person *mm = [Person shareInstance];
//    NSLog(@"%@====%@",pp,mm);
//    SEL bbb = @selector(testMethod);
//    [pp performSelector:bbb];
//
//    NSString *path = NSHomeDirectory();
    
    NSDate *now = [NSDate date];
    
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyyMMddHHmmss"];
    NSString *dateStr = [df stringFromDate:now];
     NSLog(@"当前北京时间%@",dateStr);
//    NSInteger a = 5;
//    NSParameterAssert(a==5);
//    if (a != 5) {
//        @throw [NSException exceptionWithName:@"SYValueException" reason:@"值只能为5" userInfo:nil];
//    }
//    [self assertWithPara:nil];
    
//    NSArray *empty = nil;
//    NSArray *aaa = nil;
//    if (empty == nil || [empty isKindOfClass:[NSNull class]]) {
//        NSArray *array = [NSArray arrayWithObject:@"1"];
//        aaa = array;
//
//    }else{
//        NSMutableArray *array = [empty mutableCopy];
//        [array insertObject:@"1" atIndex:0];
//
//    }
//
//    //方法一：
//    [JMVersionUpdateView showUpdateAlertWithVersion:@"1.0.0" Descriptions:@[@"1.xxxxxxxxxx",@"2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]];
//    JMWKWebView *vc = [[JMWKWebView alloc] init];
//    vc.urlStr = [NSString stringWithFormat:@"%@/coupon/couponCenter.html",@"https://h5.srsjk.com"];
////    vc.urlStr = @"https://h5.srsjk.com/test/a.html";
    JMBCouponManagerVC *vc = [[JMBCouponManagerVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
- (void)assertWithPara:(NSString *)str
{
    NSAssert(str != nil, @"参数不能为nil");
    NSParameterAssert(str); //只需要一个参数,如果参数存在程序继续运行,如果参数为空,则程序停止打印日志
    //further code ...
}
#pragma mark setAssociatedObject
- (void)objcTest{
    NSArray *array = [NSArray arrayWithObjects:@"1",@"2",@"3",@"4", nil];
    NSString *str = @"数字";
    objc_setAssociatedObject(array, &associatedKey, str, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    
    NSString *aa = objc_getAssociatedObject(array, &associatedKey);
    NSLog(@"RT%@",aa);
}


#pragma mark 制作plist文件
- (void)makePlist{
    NSString *aaa = @"";
    
    NSArray *b = [aaa componentsSeparatedByString:@","];
    
    NSLog(@"%lu",(unsigned long)b.count);
    
    NSMutableArray *all = [[NSMutableArray alloc]initWithCapacity:0];
    
    for (int i = 0; i<b.count; i++) {
        
        [all addObject:b[i]];
    }
    
    NSString *tempPath = NSTemporaryDirectory();
    
    NSString *path = [tempPath stringByAppendingPathComponent:@"newsUrlPList.plist"];
    
    //    [all writeToFile:path atomically:YES];
    NSLog(@"路径%@",path);
}
#pragma mark view闪烁
- (void)opacity{
    UILabel * myTest1 = [[UILabel alloc]initWithFrame:CGRectMake(10, 100, 60, 40)];
    myTest1.backgroundColor = [UIColor blueColor];
    myTest1.textAlignment = NSTextAlignmentCenter;
    myTest1.text = @"张明炜";
    myTest1.textColor = [UIColor purpleColor];
    [self.view addSubview:myTest1];
    [myTest1.layer addAnimation:[Methods opacityForever_Animation:0.5] forKey:nil];
}
@end
